package superbubble.entry;

import java.util.ArrayList;
import java.util.List;

public class Graph {
	private List<Edge> graphLinks;
	private List<Integer> nodes;
	private int nodesNumber;
	private int edgeNumber;

	public Graph() {
		super();
	}

	public Graph(int nodesNumber, int edgeNumber) {
		super();
		this.nodesNumber = nodesNumber;
		this.edgeNumber = edgeNumber;
		this.nodes = new ArrayList<Integer>();
		this.graphLinks = new ArrayList<Edge>();
	}

	public void addNode(int node) {
		if (!nodes.contains(node)) {
			nodes.add(node);
		}
	}

	public void addNewLink(Edge newLink) {
		graphLinks.add(newLink);
		edgeNumber++;
		if (!nodes.contains(newLink.getStartLink())) {
			nodesNumber++;
			nodes.add(newLink.getStartLink());
		}
	}

	public List<Edge> getGraphLinks() {
		return graphLinks;
	}

	public void setGraphLinks(List<Edge> graphLinks) {
		this.graphLinks = graphLinks;
	}

	public int getNodesNumber() {
		return nodesNumber;
	}

	public void setNodesNumber(int nodesNumber) {
		this.nodesNumber = nodesNumber;
	}

	public int getEdgeNumber() {
		return edgeNumber;
	}

	public void setEdgeNumber(int edgeNumber) {
		this.edgeNumber = edgeNumber;
	}

	public List<Integer> getNodes() {
		return nodes;
	}

	public void setNodes(List<Integer> nodes) {
		this.nodes = nodes;
	}

	@Override
	public String toString() {
		return "Graph [ nodesNumber=" + nodesNumber + ", edgeNumber="
				+ edgeNumber + "]";
	}

}
